<template>
  <div>
    <el-page-header @back="goBack" content="详情页面">
    </el-page-header>
    <div class="info-title">
      剧情简介
    </div>
    <div class="info-text">
      {{ film.introduction }}
    </div>
    <div class="info-title">
      电影评论
    </div>
    <div style="padding-right: 100px" v-if="evaluateList.length > 0">
      <div class="item" v-for="item in evaluateList">
        <img alt="" style="float: left;width: 55px;height: 55px;border-radius: 50%" :src="item.user.avatar">
        <div class="header-name">
          <div v-if="item.user.nickname===null" class="evaluate-user-name" style="color: darkgrey;">匿名用户
          </div>
          <div v-if="item.user.nickname!==null" class="evaluate-user-name">
            {{ item.user.nickname }}
          </div>
          <el-rate
              style="padding-top: 7px"
              v-model="item.filmEvaluate.star"
              disabled
              text-color="#ff9900"
              score-template="{value}">
          </el-rate>
        </div>
        <div class="evaluate-text">
          {{ item.filmEvaluate.comment }}
        </div>
        <i class="evaluate-time">
          {{ item.filmEvaluate.createAt }}
        </i>
        <el-divider content-position="center"></el-divider>
      </div>
    </div>
    <div v-else class="no-evaluates">
      暂无评论
    </div>
  </div>
</template>

<script>
import {FindFilmById, FindFilmEvaluateByFId} from "@/api/film";

export default {
  name: "Info",
  data() {
    return {
      film: {},
      evaluateList: [],
      filmId: this.$route.query.fid,
    }
  },

  methods: {
    goBack() {
      this.$router.go(-1)
    }
  },

  mounted() {
    FindFilmById(this.filmId).then(res => {
      this.film = res.data;
    });
    FindFilmEvaluateByFId(this.filmId).then(res => {
      this.evaluateList = res.data;
    })
  }
}
</script>

<style scoped>

.item {
  padding-bottom: 30px;
  margin-bottom: 10px;
  margin-top: 20px;
  width: 1120px;
}

.header-name {
  color: #000000;
  padding-top: 5px;
  float: left;
  padding-left: 20px;
  font-weight: bolder;
  font-size: 14px;
  letter-spacing: 2px;
}

.film-content {
  padding: 80px 200px;
  letter-spacing: 2px;
}


>>> .el-rate__icon {
  font-size: 20px;
}

>>> .el-rate__text {
  padding-left: 0px;
  font-size: 30px;
}

.el-page-header {
  color: #f0f0f0;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, Helvetica, sans-serif, "宋体";
  transition: all 0.4s ease-in-out;
}

.el-page-header.hover,
.el-page-header:hover {
  color: #7b8cf6;
  transition: all 0.4s ease-in-out;
}

::v-deep .el-page-header__content {
  color: #f0f0f0;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, Helvetica, sans-serif, "宋体";

}

.info-title {
  color: #f0f0f0;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, Helvetica, sans-serif, "宋体";
  font-weight: bolder;
  font-size: 25px;
  padding-top: 25px;
  padding-bottom: 10px
}

.info-text {
  color: #d0d0d0;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, Helvetica, sans-serif, "宋体";
  font-size: 15px;
  line-height: 30px;
  text-indent: 2.5em;
  padding-top: 20px;
  padding-bottom: 20px;
}

.evaluate-user-name {
  font-weight: 400;
  color: darkgrey;
  padding-left: 5px;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, Helvetica, sans-serif, "宋体";
}

.evaluate-text {
  text-indent: 2em;
  line-height: 28px;
  padding-left: 70px;
  padding-top: 80px;
  padding-bottom: 10px;
  color: #f0f0f0;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, Helvetica, sans-serif, "宋体";
}

.evaluate-time {
  float: right;
  padding-right: 18px;
  color: #91949c;
  font-size: 15px;
  font-family: "PingFang SC", "Microsoft YaHei", Arial, Helvetica, sans-serif, "宋体";
}

::v-deep .el-divider {
  width: 400px;
  text-align: center;
  align-content: center;
  margin-left: 360px;
  top: 40px;
  background-color: rgba(126, 126, 126, 0.24);
}

.no-evaluates {
  text-align: center;
  color: rgba(255, 255, 255, 0.18);
  font-size: 60px;
  font-family: "Microsoft YaHei", Arial, Helvetica, sans-serif, "宋体";
  font-weight: bolder;

  height: 160px;
  line-height: 200px;
}
</style>